package com.coocaa.ops.plus.dashboard.third.internalapi.config;

import com.coocaa.ops.common.tool.feign.FeignUtil;
import com.coocaa.ops.plus.dashboard.third.internalapi.InternalApiFeignClient;
import feign.codec.Decoder;
import feign.codec.Encoder;
import org.springframework.cloud.openfeign.FeignClientsConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * @author bjh
 * @description
 * @date 2021/2/3 14:46
 */
@Configuration
@Import(FeignClientsConfiguration.class)
public class InternalApiFeignConfig {
    private static final int CONNECT_TIMEOUT_MILLIS = 12000;

    private static final int READ_TIMEOUT_MILLIS = 10000;

    @Bean
    public InternalApiFeignClient internalApiFeignClient(Encoder encoder, Decoder decoder) {
        InternalApiFeignClient feignClient =
                FeignUtil.getFeignClient(encoder, decoder,InternalApiFeignClient.class, CONNECT_TIMEOUT_MILLIS, READ_TIMEOUT_MILLIS);
        return feignClient;
    }
}
